export default (obj, p) => {
    const __dp = {
        container: null,
        loop: false,
        autoplay: false,
        lang: 'cn',
        hotkey: true,
        airplay: true,
        preload: 'metadata',
        volume: 0.5,
        playbackRate: 1,
        jumpTime: 10,

        video: {},
        highlight: {},
        danmu: {}
    }

    if (!p.element) {
        __dp.container = document.getElementsByClassName('z-player')[0]
    }
    if (typeof p.element === 'string') {
        __dp.container = document.getElementById(p.element)
    } else {
        __dp.container = p.element
    }
    for (let key in __dp) {
        if (__dp.hasOwnProperty(key) && !p.hasOwnProperty(key)) {
            p[key] = __dp[key]
        }
    }
    obj.property = p
    if (!p.container) {
        throw obj.__translate('播放器dom元素获取失败')
    }
    p.container.style['pointer-events'] = 'none'
    if (p.lang) {
        p.lang = p.lang.toLowerCase()
    }
    console.log(`%c Z-PLAYER Ver_${Z_PLAYER_VERSION} %c Web: https://zzone.cc`, 'background: #122; color: #fff; border-radius: 3px; padding: 5px 0;', '')

    return p
}
